﻿
using UnityEngine;

namespace Tools.Log
{
    /// <summary>
    /// 重新简单封装Unity日志
    /// 添加上时间信息
    /// </summary>
    public static class DebugWrapper
    {
        public static void Log(string info)
        {
            Debug.Log(System.DateTime.Now.TimeFormat() + "  : " + info);
        }

        public static void LogError(string info)
        {
            Debug.LogError(System.DateTime.Now.TimeFormat() + "  : " + info);
        }

        public static void LogWarning(string info)
        {
            Debug.LogWarning(System.DateTime.Now.TimeFormat() + "  : " + info);
        }

        /// <summary>
        /// 扩展时间 now
        /// </summary>
        /// <param name="now"></param>
        /// <returns></returns>
        public static string TimeFormat(this System.DateTime now)
        {
            return now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
        }

        /// <summary>
        /// 扩展时间 now
        /// </summary>
        /// <param name="now"></param>
        /// <returns></returns>
        public static string TimeDay(this System.DateTime now)
        {
            return now.ToString("yyyy-MM-dd");
        }
    }
}